﻿using Server.Resource;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace Server.TCP
{
    class Start
    {
        public static void Main(string[] args)
        {
            Console.Title = "中辰照明灯具信息系统：TCP服务";
            CommandRegister register = new CommandRegister();
            register.Register(typeof(ImportProdPackage));

            string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ServerConfig.xml");
            XDocument doc = XDocument.Load(configPath);
            XElement root = doc.Root;

            ServerConfig.Singleton.Database = root.Element("Database").Value;
            ServerConfig.Singleton.TemplateRoot = root.Element("TemplateRoot").Value;
            ServerConfig.Singleton.ImgRoot = root.Element("ImgRoot").Value;
            ServerConfig.Singleton.ExportRoot = root.Element("ExportRoot").Value;
            ServerConfig.Singleton.ExportUrl = root.Element("ExportUrl").Value;
            ServerConfig.Singleton.Debug = root.Element("Debug").Value == "1";
            AsynchronousSocketListener.StartListening();
            Console.Read();
        }
    }
}
